time = 0


def hanoi(A, B, C, n):
    global time
    if n == 1:
        print(A, '-->', C)
        time += 1
    else:
        hanoi(A, C, B, n - 1)
        print(A, '-->', C)
        time += 1
        hanoi(B, A, C, n - 1)


x = int(input("请输入第一环的盘数"))
hanoi('A', 'B', 'C', x)
print(time)
